package com.wmh.baseservice.operationaid.controller;

import com.wmh.baseservice.common.utils.returnbody.ReturnBody;
import com.wmh.baseservice.operationaid.pojo.vo.productTrafficSourceOptions.ProductTrafficSourceOptionQueryReqVO;
import com.wmh.baseservice.operationaid.pojo.vo.productTrafficSourceOptions.ProductTrafficSourceOptionsCreateReqVO;
import com.wmh.baseservice.operationaid.pojo.vo.productTrafficSourceOptions.ProductTrafficSourceOptionsUpdateReqVO;
import com.wmh.baseservice.operationaid.service.ProductTrafficSourceOptionsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author dongaolong
 * @date 2023/7/22
 **/
@Validated
@RestController
@RequestMapping("product/trafficSourceOptions")
@Api(tags = "流量来源选项")
@Slf4j
public class ProductTrafficSourceOptionsController {

    @Resource
    private ProductTrafficSourceOptionsService productTrafficSourceOptionsService;

    @ApiOperation("添加选项")
    @PostMapping("create")
    public String create(@Valid ProductTrafficSourceOptionsCreateReqVO reqVO){
        productTrafficSourceOptionsService.create(reqVO);
        return ReturnBody.success();
    }

    @ApiOperation("修改选项")
    @PostMapping("update")
    public String update(@Valid ProductTrafficSourceOptionsUpdateReqVO reqVO){
        productTrafficSourceOptionsService.update(reqVO);
        return ReturnBody.success();
    }

    @ApiOperation("删除选项")
    @PostMapping("delete")
    public String delete(Long id){
        productTrafficSourceOptionsService.delete(id);
        return ReturnBody.success();
    }


    @ApiOperation("获取不包含基础字段的列表")
    @PostMapping("getListNotBaseField")
    public String getListNotBaseField(ProductTrafficSourceOptionQueryReqVO reqVO){
        return ReturnBody.success(productTrafficSourceOptionsService.getListNotBaseField(reqVO));
    }
}
